package ru.tapublog.lib.samsungwallet.impl.dao;

import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

@XmlAccessorType(XmlAccessType.FIELD)
public class GeofenceAlertDAO{

	private double latitude;
	private double longitude;
	private double altitude;
	@XmlElement(name="rangeinmeter")
	private int range;
	private String value;

	public GeofenceAlertDAO() {
		this(null, 0, 0, 0, 0);
	}

	public GeofenceAlertDAO(String value, double latitue, double longitude) {
		this(value, latitue, longitude, 0, 0);
	}

	public GeofenceAlertDAO(String value, double latitue, double longitude,
			double altitue) {
		this(value, latitue, longitude, altitue, 0);
	}

	public GeofenceAlertDAO(String value, double latitue, double longitude,
			double altitue, int range) {
		setValue(value);
		setLatitude(latitue);
		setLongitude(longitude);
		setAltitude(altitue);
		setRange(range);
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public double getAltitude() {
		return altitude;
	}

	public void setAltitude(double altitude) {
		this.altitude = altitude;
	}

	public int getRange() {
		return range;
	}

	public void setRange(int range) {
		this.range = range;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		long temp;
		temp = Double.doubleToLongBits(altitude);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(latitude);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		temp = Double.doubleToLongBits(longitude);
		result = prime * result + (int) (temp ^ (temp >>> 32));
		result = prime * result + range;
		result = prime * result + ((value == null) ? 0 : value.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		GeofenceAlertDAO other = (GeofenceAlertDAO) obj;
		if (Double.doubleToLongBits(altitude) != Double
				.doubleToLongBits(other.altitude))
			return false;
		if (Double.doubleToLongBits(latitude) != Double
				.doubleToLongBits(other.latitude))
			return false;
		if (Double.doubleToLongBits(longitude) != Double
				.doubleToLongBits(other.longitude))
			return false;
		if (range != other.range)
			return false;
		if (value == null) {
			if (other.value != null)
				return false;
		} else if (!value.equals(other.value))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "GeofenceAlertDAO [latitude=" + latitude + ", longitude="
				+ longitude + ", altitude=" + altitude + ", range=" + range
				+ ", value=" + value + "]";
	}

}
